<?php 
	require 'header.php';
?>
	<body >
	<?php require 'head.php';?>
	<?php require 'sidebar.php';?>
		<section>
			<div class="pbox">
				<div class="box-head">
					<div class="pull-left">
						今天是<?php 
							$week= array('日','一','二','三','四','五','六');
							echo date('Y年m月d日').'，星期'.$week[date('w')];
						?>。
					</div>
					<div class="pull-right">
						
					</div>	
				</div>
				<div class="box-body">
					<div class="indexbox">
						<div class="indexbox-head">访问统计</div>
						<div class="indexbox-body">
							<canvas id="c1"  data-type="Bar"></canvas>
						</div>
					</div>
					<div class="indexbox">
						<div class="indexbox-head">来自MISSUI.COM的服务</div>
						<div class="indexbox-body">
							
						</div>
					</div>
					<div class="indexbox">
						<div class="indexbox-head">最新反馈</div>
						<div class="indexbox-body">
							
						</div>
					</div>
					<div class="indexbox">
						<div class="indexbox-head">站内统计</div>
						<div class="indexbox-body">
							<div class="ib-scbox text-center">
								<span class="text-color-gray font-size-32 ib-scbox-num"><?php echo($dbs->count('mcms_access_log'));?></span><br />
								<span class="text-color-gray font-size-12">总访问量</span>
							</div>
							<div class="ib-scbox text-center">
								<span class="text-color-blue font-size-32 ib-scbox-num"><?php echo($db->count('mcms_post'));?></span><br />
								<span class="text-color-gray font-size-12">文章</span>
							</div>
							<div class="ib-scbox text-center">
								<span class="text-color-green font-size-32 ib-scbox-num"><?php echo($db->count('mcms_comment')+$db->count('mcms_form_collect'));?></span><br />
								<span class="text-color-gray font-size-12">回复/评论/反馈</span>
							</div>
							<div class="ib-scbox text-center">
								<span class="text-color-orange font-size-32 ib-scbox-num"><?php echo($db->count('mcms_goods'));?></span><br />
								<span class="text-color-gray font-size-12">产品</span>
							</div>
							<div class="ib-scbox text-center">
								<span class="text-color-red font-size-32 ib-scbox-num"><?php echo($db->count('mcms_member'));?></span><br />
								<span class="text-color-gray font-size-12">会员</span>
							</div>
							<div class="ib-scbox text-center">
								<span class="text-color-pure font-size-32 ib-scbox-num"><?php echo($db->count('mcms_order'));?></span><br />
								<span class="text-color-gray font-size-12">订单</span>
							</div>
							<div class="ib-scbox text-center">
								<span class="text-color-qblue font-size-32 ib-scbox-num"><?php echo($db->count('mcms_job'));?></span><br />
								<span class="text-color-gray font-size-12">招聘</span>
							</div>
							<div class="ib-scbox text-center">
								<span class="text-color-purered font-size-32 ib-scbox-num"><?php echo($db->count('mcms_branch'));?></span><br />
								<span class="text-color-gray font-size-12">分支机构</span>
							</div>
							
							<div class="clearfix"></div>
						</div>
					</div>
					<div class="clearfix"></div>
				</div>
			</div>
		</section>
		
		<pop>
			<div id="msg" class="popbox hide">
				<div class="text-center" style="padding:100px 0;line-height:200%;">
					<i class="icon icon-96 icon-warnning"></i>
					<br />
					<span id="warnMsg"></span>
				</div>
			</div>
		</pop>
		<?php require 'js.php';?>
		<script type="text/javascript" src="<?php echo($settings['renderer']['home_path'].$settings['renderer']['template_path']);?>dist/Chart.js/Chart.js"></script>
		<script type="text/javascript" src="<?php echo($settings['renderer']['home_path'].$settings['renderer']['template_path']);?>dist/layer/layer.js"></script>
		<script type="text/javascript">
			var data = {
			    labels: ["<?php echo(date('Y-m', strtotime(' -11 month')));?>", 
			    "<?php echo(date('Y-m', strtotime(' -10 month')));?>", 
			    "<?php echo(date('Y-m', strtotime(' -9 month')));?>", 
			    "<?php echo(date('Y-m', strtotime(' -8 month')));?>", 
			    "<?php echo(date('Y-m', strtotime(' -7 month')));?>", 
			    "<?php echo(date('Y-m', strtotime(' -6 month')));?>", 
			    "<?php echo(date('Y-m', strtotime(' -5 month')));?>", 
			    "<?php echo(date('Y-m', strtotime(' -4 month')));?>", 
			    "<?php echo(date('Y-m', strtotime(' -3 month')));?>", 
			    "<?php echo(date('Y-m', strtotime(' -2 month')));?>", 
			    "<?php echo(date('Y-m', strtotime(' -1 month')));?>", 
			    "<?php echo(date('Y-m'));?>"],
			    datasets: [
			        {
			            label: "月访问量",
			            borderWidth: 2,
			            data: [<?php echo(get_access(date('Y-m', strtotime(' -11 month'))));?>, 
			            <?php echo(get_access(date('Y-m', strtotime(' -10 month'))));?>, 
			            <?php echo(get_access(date('Y-m', strtotime(' -9 month'))));?>, 
			            <?php echo(get_access(date('Y-m', strtotime(' -8 month'))));?>, 
			            <?php echo(get_access(date('Y-m', strtotime(' -7 month'))));?>, 
			            <?php echo(get_access(date('Y-m', strtotime(' -6 month'))));?>, 
			            <?php echo(get_access(date('Y-m', strtotime(' -5 month'))));?>, 
			            <?php echo(get_access(date('Y-m', strtotime(' -4 month'))));?>, 
			            <?php echo(get_access(date('Y-m', strtotime(' -3 month'))));?>, 
			            <?php echo(get_access(date('Y-m', strtotime(' -2 month'))));?>, 
			            <?php echo(get_access(date('Y-m', strtotime(' -1 month'))));?>, 
			            <?php echo(get_access(date('Y-m')));?>],
			        }
			    ]
			};
			var c1 = new Chart($("#c1"), {
			    type: 'bar',
			    data: data,
			    options: {
			    	responsive: true,
			    	//onResize: ,
			    }
			});
		</script>
		<script type="text/javascript">
			<?php if($v->flag!=200){?>
				$('#warnMsg').text('<?php echo($v->msg);?>');
				gl = layer.open({
				    type: 1,
				    title:'注意，请及时续约。',
					area: ['600px', '400px'],
				    content: $('#msg')
				});
			<?php } ?>
		</script>
	</body>
</html>
